<!DOCTYPE html>
<html>
<body>
<p id="description"></p>
<div style="cursor:progress; border: 2px solid red;" id="test">Try selecting this text by dragging the cursor. Progress cursor should be displayed while doing so.</div>
<div id="console"></div>
<script src="../../resources/js-test.js"></script>
<script>
if (window.eventSender && window.internals) {
    description('Tests whether explicitly set caret style is retained on performing text selection');

    var div = document.getElementById("test");
    div.focus();

    var y = div.offsetTop + div.offsetHeight / 2;

    function leapForwardAndMove(x) {
        eventSender.leapForward(200);
        eventSender.mouseMoveTo(div.offsetLeft + x, y);
    }

    eventSender.dragMode = false;
    leapForwardAndMove(div.offsetLeft + 5);
    eventSender.mouseDown();

    leapForwardAndMove(10);

    leapForwardAndMove(div.offsetWidth - 10);

    var cursorInfo = internals.getCurrentCursorInfo();
    shouldBeEqualToString('cursorInfo', 'type=Progress');
}
</script>
</body>
</html>
